package com.agileai.pm.module.base.handler;

import com.agileai.domain.DataParam;
import com.agileai.domain.DataRow;
import com.agileai.hotweb.bizmoduler.core.StandardService;
import com.agileai.hotweb.controller.core.StandardEditHandler;
import com.agileai.hotweb.renders.LocalRenderer;
import com.agileai.hotweb.renders.ViewRenderer;
import com.agileai.pm.module.base.service.ProjectDocumentManage;

public class ProjectDocumentManageEditHandler
        extends StandardEditHandler {
    public ProjectDocumentManageEditHandler() {
        super();
        this.listHandlerClass = ProjectDocumentManageListHandler.class;
        this.serviceId = buildServiceId(ProjectDocumentManage.class);
    }

    
    public ViewRenderer prepareDisplay(DataParam param) {
		String operaType = param.get(OperaType.KEY);
		if (isReqRecordOperaType(operaType)){
			StandardService standardService = (StandardService)this.lookupService(this.getServiceId());
			DataRow record = standardService.getRecord(param);
			this.setAttributes(record);	
		}
		this.setAttribute("PI_ID", param.getString("PI_ID"));
		this.setOperaType(operaType);
		processPageAttributes(param);
		return new LocalRenderer(getPage());
	}
    
    protected void processPageAttributes(DataParam param) {
    }

    protected ProjectDocumentManage getService() {
        return (ProjectDocumentManage) this.lookupService(this.getServiceId());
    }
}
